<?php

namespace app\api\controller\resell;

use app\api\BaseController;
use app\api\service\ResellService;

class GoodsController extends BaseController
{
    /**
     * 获取转卖商品列表
     * */
    public function index()
    {
        $store_id = $this->request->param('store_id/d');

        if (empty($store_id)){
            return  json(['code' =>0,'msg' => '非法参数!']);
        }

        $goodsList = ResellService::getResellGoodsList($store_id);

        return json(['code' =>1, 'data' => $goodsList, 'msg' => '获取成功!']);
    }

    /**
     * 获取转卖商品详情
     * */
    public function read()
    {
        $resell_goods_id = $this->request->param('resell_goods_id/d');

        if (empty($resell_goods_id)){
            return  json(['code' =>0, 'msg' =>'非法请求']);
        }

        $goods = ResellService::findResellGoodsDetail($resell_goods_id);

        return json(['code' =>1, 'data' => $goods, 'msg' => '获取成功!']);
    }
}